package com.ldzy.service.serviceIpmI;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ldzy.dao.CakeMapper;
import com.ldzy.dao.RecordMapper;
import com.ldzy.pojo.Cake;
import com.ldzy.pojo.Record;
import com.ldzy.service.ICakeService;
import com.ldzy.service.IRecordService;
import com.ldzy.utilts.RespUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class ICakeServiceIpmI  extends ServiceImpl<CakeMapper, Cake> implements ICakeService {
  @Resource CakeMapper cakeMapper;
    @Override
    public RespUtil findHou() {
       if (cakeMapper.findHou().size()!=0)
           return  RespUtil.success(cakeMapper.findHou());
       return RespUtil.error();
    }

    @Override
    public RespUtil search(Cake cake) {
        if (cakeMapper.search(cake).size()!=0)
            return  RespUtil.success(cakeMapper.search(cake));
        return RespUtil.success( cakeMapper.findHou());
    }

    @Override
    public RespUtil type() {
        if (cakeMapper.type().size()!=0)
            return  RespUtil.success(cakeMapper.type());
        return RespUtil.error();
    }

    @Override
    public RespUtil findByType(Cake cake) {
        if (cakeMapper.findByType(cake).size()!=0)
            return  RespUtil.success(cakeMapper.findByType(cake));
        return RespUtil.error();
    }

    @Override
    public RespUtil findHouSex() {
        if (cakeMapper.findHouSex().size()!=0)
            return  RespUtil.success(cakeMapper.findHouSex());
        return RespUtil.error();
    }

    @Override
    public void cakeNumber(Cake cake) {
        cakeMapper.cakeNumber(cake);
    }
}
